package paytreasure.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class OrderNumber {
	
	public static void main(String[] args) {
		System.out.println(getMerOrder());
	}
	
	// 获取订单号
	public static String getOrders() {
		Date nowDate = new Date();
	//	String date = new SimpleDateFormat("yyyyMMdd").format(nowDate);
		String seconds = new SimpleDateFormat("HHmmss").format(nowDate);
	//	return date + "00001000" + getTwo() + "00" + seconds + getTwo();
		return "00001000" + getTwo() + "00" + seconds + getTwo();
	}

	/**
	 * 获取余额宝订单号
	 */

	public static String getYorders() {
		Date nowDate = new Date();
//		String date = new SimpleDateFormat("yyyyMMdd").format(nowDate);
		String seconds = new SimpleDateFormat("HHmmss").format(nowDate);
//		return date + getTwo() + "00" + seconds + getTwo();
		return getTwo() + "00" + seconds + getTwo();
	}


	/**
	 * 随机产生16位数
	 */
	public static String getMerOrder() {
		String num = "";
		for (int i = 0; i < 8; i++) {
			num += getTwo();
		}
		return num;
	}

	/**
	 * 产生随机的2位数
	 * 
	 * @return
	 */
	public static String getTwo() {
		Random rad = new Random();
		String result = rad.nextInt(100) + "";
		if (result.length() == 1) {
			result = "0" + result;
		}
		return result;
	}
}
